var language_=null;
var text_main=null;
var language_C=function language_C(action){
  $('.choose_language').removeClass('color_yellow');
  $('#'+action).addClass('color_yellow');
  if (action=="zh") {
  	localStorage["la"]="zh";
    $('._submit').text('提交');
    $('.tit').text('快速阅读');
    $('.textk').val('粘贴到下面的文本速读你想读的应用');
    text_main='粘贴到下面的文本速读你想读的应用';
  }else{
  	localStorage["la"]="en";
    $('._submit').text('submit');
    $('.tit').text('SpeedReader');
    $('.textk').val('Paste into here the text you want to read in the speedreader app!');
  	text_main='Paste into here the text you want to read in the speedreader app!';
  }
}
  var sub=function sub(){
    var t=document.getElementById('fei').value;
    if ((t=="")||(t==text_main)) {
      return;
    }else{
      if (t.length<20) {
        alert('内容太短');
      }else{
        $.get("http://115.29.194.90:3000/save", {text: t },function(data){alert(data['fei'])} );
      }
    }
}

var init = function (){	
	if (localStorage["la"]) {
		language_=localStorage["la"];
	}else{
		language_="en";
	}
	language_C(language_);
  $("textarea").focus(function(){
    if(this.value == text_main) this.value = '';
  });
  $("textarea").blur(function(){
    if(this.value =='') this.value = text_main;
  });
}
$(init);